fix(lotw): normalize CRLF to LF in tCERT body so LoTW accepts uploads#213
Merged
Conversation
node-forge emits PEM with \r\n line endings (pem.js:46,82,84 and util.js:1602 encode64 wraps at maxline=64 with \r\n). Wavelog's reference .tq8 — which we're matching — comes from PHP's openssl_x509_export, which uses \n. So our tCERT block ships the certificate body with CRLF between base64 lines and LoTW's processor rejects the QSOs silently. The symptom is exactly what K1AF saw: LoTW's upload endpoint replies "<!-- .UPL. accepted --> File queued for processing" (multipart POST received, file in queue), but the queue worker then drops the file in a way that doesn't move the operator's "Last upload" timestamp on the Logbook Call Sign Activity page. Rejection email goes to the cert holder. Fix: collapse \r\n (and any stray \r) to \n in certPemBody after stripping the BEGIN/END markers. This does NOT affect the per-QSO RSA-SHA1 signatures — those are over the canonical sign-string, not over the PEM. Only the cert body emitted in the tCERT record needs to match the reference line-ending convention. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Almost certainly the reason K1AF's LoTW "Last upload" timestamp hasn't moved from 2025-07-28 despite every upload from this app reporting success since #185.
What's happening:
node-forge'scertificateToPemproduces PEM with\r\nline endings (node_modules/node-forge/lib/pem.js:46,82,84andutil.js:1602—encode64wraps base64 atmaxline=64with\r\n)..tq8we're matching comes from PHP'sopenssl_x509_export, which uses\nonly.tCERTblock ships the certificate body with CRLF between base64 lines instead of LF. LoTW's queue processor silently rejects every QSO in the file.Why the upload looks like it succeeded:
LoTW's upload endpoint replies
<!-- .UPL. accepted --> File queued for processingas soon as the multipart POST is received — that marker means "your file is in our queue", not "we processed it". The queue worker runs later, parses the.tq8, and (in this case) drops everything because the cert body doesn't match the expected line-ending convention. Operator "Last upload" timestamp on Logbook Call Sign Activity doesn't move, and the cert holder gets a rejection email.Fix
Collapse
\r\n(and any stray\r) to\nincertPemBodyafter stripping the BEGIN/END markers, before emitting intCERT.This does NOT affect the per-QSO RSA-SHA1 signatures — those are over the canonical sign-string, not over the PEM. Only the cert body the LoTW parser ingests needs to match.
Test plan
After deploying:
lotw_qsl_sent='Y'/lotw→ "Upload now"🤖 Generated with Claude Code